import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/layout' //布局页



Vue.use(VueRouter)

// 通用页面, 这里的配置不需要权限
export const constRouter = [
  {
      path: '/login',
      component: () => import('@/views/login/Login'),
      hidden: true //导航菜单忽略选项
  },
  {
      path: '',
      component: Layout, //应用布局页
      redirect: '/index',
      hidden: true,
  },
  {
      path: '/index',
      component: Layout, //应用布局页
      name: 'index',
      meta:{
          title: "首页", //导航菜单项标题
          icon: 'el-icon-s-home' //导航菜单图标
      },
      children: [
        {
          path: '',
          component: () => import('@/views/index/index.vue'),
          name: 'indexs',
          meta: {
            title: "工作台",
            icon: 'el-icon-s-home',
            roles: ['admin','jerry']
          }
        }
      ]
  }
]

// 动态路由 communication
export const asyncRoutes = [
    {
        path: '/daping',
        component: Layout,
        redirect: '/daping/index',
        meta:{
            title: "实时大屏",
            icon: 'el-icon-s-goods',
            hidden: false,
        },
        children: [
            {
                path: 'dapingfx1',
                component: () => import('@/views/daping.vue'),
                name: 'dapingfx1',
                meta: {
                    title: "实时大屏分析1",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },{
                path: 'dapingfx2',
                component: () => import('@/views/daping.vue'),
                name: 'dapingfx2',
                meta: {
                    title: "实时大屏分析2",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            }
        ]
    },
  {
    path: '/test',
    component: Layout,
    redirect: '/test/index',
    meta:{
      title: "流量分析",
      icon: 'el-icon-s-goods',
      hidden: false,
    },
    children: [
      {
        path: 'productcartpv',
        component: () => import('@/views/liuliang/productcartpv.vue'),
        name: 'productcartpv',
        meta: {
          title: "购物车流量pv分析",
          icon: 'el-icon-tickets',
          hidden: false,
          roles: ['admin','jerry']
        }
      },{
        path: 'productcartuv',
        component: () => import('@/views/liuliang/productcartuv.vue'),
        name: 'productcartuv',
        meta: {
          title: "购物车流量uv分析",
          icon: 'el-icon-tickets',
          hidden: false,
          roles: ['admin','jerry']
        }
      },
        {
            path: 'productcartproduct',
            component: () => import('@/views/liuliang/productcartproduct.vue'),
            name: 'productcartproduct',
            meta: {
                title: "购物车商品流量分析",
                icon: 'el-icon-tickets',
                hidden: false,
                roles: ['admin','jerry']
            }
        },
        {
            path: 'divicepv',
            component: () => import('@/views/liuliang/divicepv.vue'),
            name: 'divicepv',
            meta: {
                title: "终端流量pv分析",
                icon: 'el-icon-tickets',
                hidden: false,
                roles: ['admin','jerry']
            }
        },{
            path: 'diviceuv',
            component: () => import('@/views/liuliang/diviceuv.vue'),
            name: 'diviceuv',
            meta: {
                title: "终端流量uv分析",
                icon: 'el-icon-tickets',
                hidden: false,
                roles: ['admin','jerry']
            }
        },
        {
            path: 'diviceproduct',
            component: () => import('@/views/liuliang/diviceproduct.vue'),
            name: 'diviceproduct',
            meta: {
                title: "终端商品流量分析",
                icon: 'el-icon-tickets',
                hidden: false,
                roles: ['admin','jerry']
            }
        }
    ]
  },
    {
        path: '/youfanorder',
        component: Layout,
        redirect: '/youfanorder/index',
        meta:{
            title: "订单分析",
            icon: 'el-icon-s-goods',
            hidden: false,
        },
        children: [
            {
                path: 'ordernumbers',
                component: () => import('@/views/trade/ordernumbers.vue'),
                name: 'ordernumbers',
                meta: {
                    title: "订单趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },{
                path: 'usernumsernumbers',
                component: () => import('@/views/trade/usernumsernumbers.vue'),
                name: 'usernumsernumbers',
                meta: {
                    title: "订单用户趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },
            {
                path: 'totalAmount',
                component: () => import('@/views/trade/totalAmount.vue'),
                name: 'totalAmount',
                meta: {
                    title: "大盘报表分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },
            {
                path: 'productnumser',
                component: () => import('@/views/trade/productnumser.vue'),
                name: 'productnumser',
                meta: {
                    title: "订单商品趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            }
        ]
    },
    {
        path: '/youfanproduct',
        component: Layout,
        redirect: '/youfanproduct/index',
        meta:{
            title: "商品分析",
            icon: 'el-icon-s-goods',
            hidden: false,
        },
        children: [
            {
                path: 'productnumberssum',
                component: () => import('@/views/productinfo/productnumberssum.vue'),
                name: 'productnumberssum',
                meta: {
                    title: "上架商品趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },{
                path: 'producttradenumbes',
                component: () => import('@/views/productinfo/producttradenumbes.vue'),
                name: 'producttradenumbes',
                meta: {
                    title: "商品成交趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            }
        ]
    },
    {
        path: '/youfanmerchant',
        component: Layout,
        redirect: '/youfanmerchant/index',
        meta:{
            title: "商家分析",
            icon: 'el-icon-s-goods',
            hidden: false,
        },
        children: [
            {
                path: 'merchantnumbers',
                component: () => import('@/views/productinfo/merchantnumbers.vue'),
                name: 'merchantnumbers',
                meta: {
                    title: "商家数趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            },{
                path: 'merchantshopnubmers',
                component: () => import('@/views/productinfo/merchantshopnubmers.vue'),
                name: 'merchantshopnubmers',
                meta: {
                    title: "商家开店数趋势分析",
                    icon: 'el-icon-tickets',
                    hidden: false,
                    roles: ['admin','jerry']
                }
            }
        ]
    }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes: constRouter
})

export default router

